<?php

/**
 * Generated Model class.
 */
class Base_PhotoGalleryPeer extends Db_Peer implements ISingleton
{

    const ID = '`photo_gallery`.`id`';

    const NAME = '`photo_gallery`.`name`';

    const PROFILE_ID = '`photo_gallery`.`profile_id`';

    const DESCRIPTION = '`photo_gallery`.`description`';

    const CREATED = '`photo_gallery`.`created`';

    const VIEW_COUNT = '`photo_gallery`.`view_count`';

    protected $_name = 'photo_gallery';

    protected $_rowClass = 'PhotoGalleryRow';

    protected $_dependentTables = array('Photo2galleryPeer');

    protected $_referenceMap = array();

    private static $_instance = null;

    protected $_metadata = array(
        'id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'photo_gallery',
            'COLUMN_NAME' => 'id',
            'COLUMN_POSITION' => 1,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => true,
            'PRIMARY_POSITION' => 1,
            'IDENTITY' => true
            ),
        'name' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'photo_gallery',
            'COLUMN_NAME' => 'name',
            'COLUMN_POSITION' => 2,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => '64',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'profile_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'photo_gallery',
            'COLUMN_NAME' => 'profile_id',
            'COLUMN_POSITION' => 3,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'description' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'photo_gallery',
            'COLUMN_NAME' => 'description',
            'COLUMN_POSITION' => 4,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '255',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'created' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'photo_gallery',
            'COLUMN_NAME' => 'created',
            'COLUMN_POSITION' => 5,
            'DATA_TYPE' => 'datetime',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'view_count' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'photo_gallery',
            'COLUMN_NAME' => 'view_count',
            'COLUMN_POSITION' => 6,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            )
        );

    /**
     * @return PhotoGalleryPeer
     */
    public static function getInstance()
    {
        if (!self::$_instance) {
        	self::$_instance = new PhotoGalleryPeer();
        }
        return self::$_instance;
    }

    /**
     * @return Db_Rowset
     */
    public function findById($id)
    {
        $select = $this->select();
        $select->where('`id` = ?', $id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByName($name)
    {
        $select = $this->select();
        $select->where('`name` = ?', $name);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByProfileId($profile_id)
    {
        $select = $this->select();
        $select->where('`profile_id` = ?', $profile_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByDescription($description)
    {
        $select = $this->select();
        $select->where('`description` = ?', $description);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByCreated($created)
    {
        $select = $this->select();
        $select->where('`created` = ?', $created);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByViewCount($view_count)
    {
        $select = $this->select();
        $select->where('`view_count` = ?', $view_count);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }


}

